import request from '@/config/axios'

// 药品 VO
export interface MedicineVO {
  medicineId: number // 药品id
  medicineName: string // 药品通用名
  brandName: string // 商品名
  form: string // 剂型
  dosage: string // 规格(如10mg)
  barcode: string // 条形码
  category: string // 药品分类
  isPrescription: boolean // 是否处方药(1:是)
  instructions: string // 使用说明
}

// 药品 API
export const MedicineApi = {
  // 查询药品分页
  getMedicinePage: async (params: any) => {
    return await request.get({ url: `/remind/medicine/page`, params })
  },

  // 查询药品详情
  getMedicine: async (id: number) => {
    return await request.get({ url: `/remind/medicine/get?id=` + id })
  },

  // 新增药品
  createMedicine: async (data: MedicineVO) => {
    return await request.post({ url: `/remind/medicine/create`, data })
  },

  // 修改药品
  updateMedicine: async (data: MedicineVO) => {
    return await request.put({ url: `/remind/medicine/update`, data })
  },

  // 删除药品
  deleteMedicine: async (id: number) => {
    return await request.delete({ url: `/remind/medicine/delete?id=` + id })
  },

  // 导出药品 Excel
  exportMedicine: async (params) => {
    return await request.download({ url: `/remind/medicine/export-excel`, params })
  },
}